import { defineConfig } from 'vite'
import { fileURLToPath, URL } from 'node:url'
import vue from '@vitejs/plugin-vue'

// https://vitejs.dev/config/
export default defineConfig({
  base: './',
  plugins: [vue()],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  optimizeDeps: {
    include: ['axios'],
  },
  // server: {
  //   post:'3000',
  //   host: '127.0.0.1',
  //   cors: true,
  //   //open: true, // 是否在服务器启动时自动在浏览器中打开应用
  //   https: false, // 是否启用https
  //   proxy: {
  //     '/api': {
  //       target: 'http://139.196.51.59:8080/', //目标域名
  //       changeOrigin: true, //需要代理跨域
  //       rewrite: (path) => path.replace(/^\/api/, ''), //路径重写，把'/api'替换为''
  //     }
  //   }
  // },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: '@use "src/assets/style/mixin.scss" as *;'
      }
    }
  }
})
